﻿using System;
using System.Data;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Data.Common;
using System.Data.Entity;

namespace Jlob.OpenErpNet.EFProvider.Test
{
    [TestClass]
    public class BaseTest
    {
        protected const string SampleProviderName = "Jlob.OpenErpNet.EFProvider";

        [TestMethod]
        public void Test_Provider_can_be_accessed()
        {
            Assert.IsNotNull(DbProviderFactories.GetFactory(SampleProviderName));
        }

        [TestMethod]
        public void Test_Provider_is_used()
        {
            DbContext nwEntities = new TestContext("name=OpenErpConnection");
            DbConnection con = nwEntities.Database.Connection;
            con.Open();
        }
    }

    class TestContext : DbContext
    {
        public TestContext(string connection)
            : base(connection)
        {
        }
    }
}
